//
//  ManagerTodayShareCardInfoVC.m
//  QRMaster
//
//  Created by lc on 16/6/1.
//  Copyright © 2016年 myApple. All rights reserved.
//

#import "ManagerTodayShareCardInfoVC.h"
#import "CardShareInfoCell.h"
@interface ManagerTodayShareCardInfoVC ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) UITableView * shareCardInfoTableView;
@property (nonatomic,strong) NSArray * titleStrArr;
@property (nonatomic,strong) NSArray * infoStrArr;

@end

@implementation ManagerTodayShareCardInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColorFromRGB(0xebebeb);
    self.navigationItem.title = @"详细信息";
    _titleStrArr = @[@"分享人",@"接收人",@"房卡信息",@"开始时间",@"结束时间",@"分享时间"];
    _infoStrArr = @[_dataModel.shareCardUserName,[NSString stringWithFormat:@"+%@ %@",_dataModel.shareAreaCode,_dataModel.telePhone],[NSString stringWithFormat:@"%@ %@ %@ %@",_dataModel.roomName,_dataModel.floorName,_dataModel.bulidingName,_dataModel.communityName],_dataModel.beginTime,_dataModel.endTime,_dataModel.shareCardTime];
    [self prepareTableView];
}

- (void)prepareTableView{
    _shareCardInfoTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT-64)];
    _shareCardInfoTableView.backgroundColor = [UIColor clearColor];
    _shareCardInfoTableView.dataSource = self;
    _shareCardInfoTableView.delegate = self;
    [self.view addSubview:_shareCardInfoTableView];
    
    UIView * headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 16)];
    headerView.backgroundColor = UIColorFromRGB(0xebebeb);
    UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 15.5, UI_SCREEN_WIDTH ,0.5)];
    lineView.backgroundColor = UIColorFromRGB(0xc1c1c1);
    [headerView addSubview:lineView];
    _shareCardInfoTableView.tableHeaderView = headerView;

    UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 1)];
    footerView.backgroundColor = UIColorFromRGB(0xc1c1c1);
    _shareCardInfoTableView.tableFooterView = footerView;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString * ID = @"cell";
    CardShareInfoCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(!cell){
        cell = [[CardShareInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    cell.titleLabel.text = _titleStrArr[indexPath.row];
    cell.infoLabel.text = _infoStrArr[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 56;
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
